using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class BlackHole_HotKeyController : MonoBehaviour
{
    [SerializeField]private KeyCode m_KeyCode;
    private TextMeshProUGUI m_text;
    private Transform Enemy;
    private BlackHoleController blackHoleController;
    private SpriteRenderer sr;

    public void SetHotKey(KeyCode keyCode, Transform transform, BlackHoleController blackHoleController)
    {
        this.m_text = GetComponentInChildren<TextMeshProUGUI>();
        sr = GetComponentInChildren<SpriteRenderer>();
        m_KeyCode = keyCode;
        m_text.text = keyCode.ToString();
        this.Enemy = transform;
        this.blackHoleController = blackHoleController;
    }


    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(m_KeyCode))
        {           
            blackHoleController.AddEnemyToList(Enemy);
            m_text.color = Color.clear;
            sr.color = Color.clear;
        }
    }
}
